/**
* User: Oleksii Savchenko
* Date: 24.01.13
* Time: 17:45
*/
describe('Animantor', function(){
    beforeEach(function(){
        this.clock = sinon.useFakeTimers();
        this.div = document.createElement("div");
        var text = document.createTextNode("text");
        this.div.appendChild(text);
        this.body = document.getElementsByTagName("body");
        this.body[0].appendChild(this.div);
    });

    afterEach(function(){
        this.clock.restore();
        this.body[0].removeChild(this.div);
    });

    it('should has method hide', function(){
        expect(animator.hide).toBeDefined();
    });

    it('can hide element with delay of hiding', function(){
        var el = document.getElementsByTagName('div');
        animator.hide(el[0], 800);

        var cs = window.getComputedStyle(this.div, "");
        var display = cs.getPropertyValue("display");

        expect(display).toBe('block');

        this.clock.tick(800);

        var testDiv = document.getElementsByTagName("div");
        var cs1 =  window.getComputedStyle(testDiv[0], "");

        var display = cs1.getPropertyValue("display");

        expect(display).toBe('none');
        el[0].setAttribute("style", "display: block");
    });


});